

const btn1 = document.getElementById("btn1")
const btn2 = document.getElementById("btn2")
const btn3 = document.getElementById("btn3")
const input = document.getElementById("inp")
btn1.onclick = () => {
    console.log(window)
    // window.alert(myAPI.version)
    myAPI.invokeWithData("sendDataToMain", myAPI.version).then(dialog => {
        console.log("data:", dialog)
        dialog.showMessageBox({
            type: "info", // info, error, warning
            // icon: "resource/images/code.ico",
            title: "electron测试",
            message: myAPI.version,
            detail: "版本"
        })
    }).catch(err => {
        console.log("err:", err)
    })
}
btn2.onclick = () => {
    myAPI.saveFile(input.value)
}
btn3.onclick = async () => {
    const res = await myAPI.readFile()
    // alert(res)
}
